import axios from 'axios'
import store from '@/store'
const request = axios.create({
    baseURL:"http://m.efront.top/index.php/api"
})
// 添加请求拦截器
request.interceptors.request.use(config=>{
    const userinfo = store.state.user.userInfo
    if(userinfo&&userinfo.access_token){
        // 添加请求头token
        config.headers.Authorization = `Bearer ${userinfo.access_token}`
    }
    return config
},err=>{
    return Promise.reject(err)
})
export default request